<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="../common/jspcommon.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>站内信 - 爽客网</title>
<%@include file="../common/js.jsp" %>
<link href="css/pager.css" type="text/css" rel="stylesheet" />
<link href="../../css/base/reset.css" type="text/css" rel="stylesheet" />
<link href="../../css/base/base.css" type="text/css" rel="stylesheet" />
<link href="../../css/base/hf_sk.css" type="text/css" rel="stylesheet" />
<link href="../../css/other.css" type="text/css" rel="stylesheet" />

<!--[if ie 6]><script src="../js/common/iepng.js" type="text/javascript"></script><![endif]-->
<!--[if ie 6]><link href="../../css/jrIE6.css" type="text/css" rel="stylesheet"><![endif]-->
<!--[if ie 6]><link href="../../css/jrIE.css" type="text/css" rel="stylesheet"><![endif]-->
<script language="javascript">
<!--

	$(function(){
		$("#page").pager({
	    	pagenumber : '${pageModel.currentPage}',
	    	pagecount : '${pageModel.totalPage}',
	    	buttonClickCallback : function(page) {
	    		window.location.href = "messages.htm?page="+page;
	    	}
	    });
	});
	
	//全选
	function checkAll(){
		var thisValue = $(".mes_foot").find("input:first").attr("checked");
		var isAll = false;
		if(thisValue == "checked"){
			isAll = true;
		}
		$(".mes_det_box").find("input:checkbox").attr("checked",isAll);
	}
	
	//删除
	function delMessages(){
		var messagesId = "";
		$(".check_messages").each(function(i){
			if($(this).find("input:checkbox").attr("checked") == "checked"){
				messagesId += "_" + $(this).find("input:first").val();
			}
		});
		if(messagesId == ""){
			alert("请选择删除项！");
			return;
		}
		$.post("delmessages.htm",{
			ids : messagesId
		},function(data){
			if(data == "success"){
				$(".check_messages").each(function(i){
					if($(this).find("input:checkbox").attr("checked") == "checked"){
						$(this).remove();
					}
				});
			}else{
				alert("系统有点抽经，请稍后重试！");
			}
		});
	}
	//
	function showmessage(self){
		$(self).parent().parent().parent().find(".mes_det").toggle();
	}
//-->
</script>
</head>
<body>
	<!-- head -->
	<%@include file="../common/header.jsp" %>
    <!-- header-->

	<div class="wrap">
    	<div class="w965 mg i_main_box">
        	<!-- left -->
            <%@include file="../member/myLeft.jsp" %>
            <!-- left--end-->
            <!-- right -->
            <div class="i_right_box" style="height:1500px;">
            	<div class="i_account_wrap dp_wrap">
                	<h1>站内信</h1>
                    <div class="ml20 mr20">
                    	<ul class="i_title_sorts">
                        	<li class="current">
                            	收件箱
                            </li>
                        </ul>
                        <div class="web_mes_box">
                        	<ul class="mes_head">
                            	<li class="firstL">标题</li>
                                <li class="secL">发件人</li>
                                <li class="thirdL">时间</li>
                            </ul>
                            <ul class="mes_det_box">
                            <c:forEach items="${pageModel.list }" var="m">
                            	<li class="check_messages">
                                	<div class="mes_item clearfix">
                                    	<div class="first">
                                			<input type="checkbox" class="cb_style" value="${m.id }" /><a href="javascript:void(0);" onclick="showmessage(this)" class="title">系统消息</a>
                                        </div>
                                        <div class="sec">爽客管理员</div>
                                        <div class="third"><fmt:formatDate value="${m.gmtCreated }" pattern="yyyy-MM-dd HH:mm:ss" /></div>
                                    </div>
									<p class="mes_det" style="display: none;">
                                    	${m.content }
                                    </p>
                                </li>
                            </c:forEach>
                            </ul>
                            <div class="mes_foot">
                            	<input type="checkbox" onclick="checkAll()"/><label>全选</label>
                                <input type="button" value="删除" class="def_btn" onclick="delMessages()"/>
                            </div>
                            <div id="page" class="h_page"></div>
                        </div>
                        
                       
                    </div>
                </div>
            </div>
            <!-- right--end -->
        </div>
    </div>
    
	    <!-- foot-->
	    <%@include file="../common/footer.jsp" %>
	    <!-- foot--end-->
    
</body>
</html>